home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-01-16 | 5.0 KB | 203 lines | [TEXT/MMCC] |
-
- /* My_basic_window Handle this Window */
- /* Copyright © 1994 George R. Cossey */
-
- /*
- File name: My_basic_window
- Function: Handle a Window
- History: 1/16/94 Original by George Cossey
-
- */
-
- #include "mmCommonMM_Demo.h" /* Common */
- #include "CommonMM_Demo.h" /* Common */
-
- /* ======================================================= */
- /* ======================================================= */
-
- void CWMy_basic_window::Init()
- {
- inherited::Init();
- }
-
-
- /* ======================================================= */
-
- void CWMy_basic_window::CloseExtras(Ptr theWS)
- {
- My_basic_windowPRec myWS;
-
- inherited::CloseExtras(theWS);
- myWS = (My_basic_windowPRec)theWS;
- }
-
- /* ======================================================= */
-
- void CWMy_basic_window::UpdateExtras(Ptr theWS)
- {
- My_basic_windowPRec myWS;
-
- inherited::UpdateExtras(theWS);
- myWS = (My_basic_windowPRec)theWS;
- }
-
- /* ======================================================= */
-
- void CWMy_basic_window::OpenExtras(Ptr theWS)
- {
- My_basic_windowPRec myWS;
-
- inherited::OpenExtras(theWS);
- myWS = (My_basic_windowPRec)theWS;
- }
-
- /* ======================================================= */
-
- void CWMy_basic_window::ActivateExtras(Boolean Do_An_Activate,Ptr theWS)
- {
- My_basic_windowPRec myWS;
-
- inherited::ActivateExtras(Do_An_Activate,theWS);
- myWS = (My_basic_windowPRec)theWS;
-
- if (!Do_An_Activate) /* Handle the deactivate */
- {
- }
- else
- {
- }
- }
-
- /* ======================================================= */
-
- void CWMy_basic_window::HandleExtraButtons(Ptr theWS,ControlHandle theControl,short *UnHiliteValue)
- {
- My_basic_windowPRec myWS;
- short theSelection;
- long RefCon;
-
-
- inherited::HandleExtraButtons(theWS,theControl,UnHiliteValue);
- myWS = (My_basic_windowPRec)theWS;
-
- RefCon = GetCRefCon(theControl); /* get control refcon */
-
- switch (RefCon) /* Select correct button */
- {
- case ResC_Button: /* Button, Button */
- break;
- case ResC_Rect_hotspot2: /* HotSpot, Rect hotspot2 */
- break;
- case ResC_Icon: /* Icon, Icon */
- break;
- case ResC_Sicn: /* Sicn, Sicn */
- break;
- case ResC_Picture: /* Picture, Picture */
- break;
- case ResC_Tool_palette: /* Tool palette, Tool palette */
- break;
-
- default: /* allow other buttons, trap for debug */
- break; /* end of otherwise */
- } /* end of switch */
- }
-
- /* ======================================================= */
-
- void CWMy_basic_window::HandleExtraCheckboxes(Ptr theWS,ControlHandle theControl)
- {
- My_basic_windowPRec myWS;
- long RefCon; /* RefCon for controls */
-
-
- inherited::HandleExtraCheckboxes(theWS,theControl);
- myWS = (My_basic_windowPRec)theWS;
-
- RefCon = GetCRefCon(theControl); /* get control refcon */
-
- switch (RefCon) /* Select correct control */
- {
- case ResC_Checkbox: /* Checkbox, Checkbox */
- if (myWS->Value_Checkbox == 0)
- {
- }
- else
- {
- }
- break;
-
-
- default: /* allow other checkboxes and radios, trap for debug */
- break; /* end of otherwise */
- } /* end of case */
- }
-
- /* ======================================================= */
-
- /* Routine: HandleScrollBar */
- /* Purpose: Handle a ScrollBar being pressed */
-
- void CWMy_basic_window::HandleScrollBar(short code,ControlHandle theControl,Point myPt)
- {
- long RefCon; /* RefCon for controls */
-
-
- inherited::HandleScrollBar(code,theControl,myPt);
- RefCon = GetCRefCon(theControl); /* get control refcon */
-
- switch (RefCon) /* Select correct scrollbar */
- {
- case ResC_Scroll_bar: /* Scroll bar, Scroll bar */
- break;
-
- default: /* allow other buttons, trap for debug */
- break; /* end of otherwise */
- } /* end of switch */
- }
-
- /* ======================================================= */
-
- /* Routine: HandleEvent */
- /* Purpose: Handle action to our window, like controls */
-
- void CWMy_basic_window::HandleEvent(EventRecord *myEvent)
- {
- short code; /* Location of event in window or controls */
- WindowPtr whichWindow; /* Window pointer where event happened */
- Point myPt; /* Point where event happened */
- ControlHandle theControl; /* Handle for a control */
- My_basic_windowPRec theWS;
-
-
- inherited::HandleEvent(myEvent);
- code = FindWindow(myEvent->where,&whichWindow); /* Get where in window and which window */
-
- if (this->RecPtr != nil) /* Only do if the window is us */
- {
- theWS = this->RecPtr;
-
- if (myEvent->what == mouseDown)
- {
- myPt = myEvent->where; /* Get mouse position */
- GlobalToLocal(&myPt); /* Make it relative */
-
- if (PtInRect(myPt,&theWS->TERect_Edit_Text)) /* Check for pressed in the TE Edit Text */
- {
- }
-
- }
-
- if ((theWS->theWindow == whichWindow) && (code == inContent)) /* for our window */
- {
- myPt = myEvent->where; /* Get mouse position */
- GlobalToLocal(&myPt); /* Make it relative */
-
- code = FindControl(myPt,whichWindow,&theControl); /* Get type of control */
- }
- }
- }
-
-
- /* ======================================================= */
- /* ======================================================= */
-